package j05arraylist;

import java.util.ArrayList;
import java.util.Collection;

public class J1 {
    public static void main(String[] args) {
        ArrayList arr1 = new ArrayList();
        arr1.add(3);
        arr1.add("abc");
        arr1.add(true);
        System.out.println("arr1 = " + arr1);
        System.out.println("====");
        ArrayList<String> arr2 = new ArrayList<>();
        arr2.add("aaa");
        arr2.add("bbb");
        arr2.add("cc");
        arr2.add(2,"kk");
        System.out.println("arr2 = " + arr2);

        Collection<String> c1 = arr2;
        ArrayList<String> arr3 = new ArrayList<>();
        arr3.add("000");
//        arr3.addAll(c1);
        arr3.addAll(arr2);
        System.out.println("arr3 = " + arr3);
    }
}

class J2{
    public static void main(String[] args) {
        ArrayList<String> arr1 = new ArrayList<>();
        arr1.add("a");
        arr1.add("b");
        arr1.add("c");

//        ArrayList<String> arr2 = new ArrayList<>(arr1);
//        System.out.println("arr2 = " + arr2);
//
//        ArrayList arr3 = new ArrayList(100);

//        arr1.remove("b");
//        System.out.println("arr1 = " + arr1);
//
//        ArrayList<String> arr2 = new ArrayList<>();
//        arr2.add("a1");
//        arr2.add("c1");
//
//        System.out.println(arr1.removeAll(arr2));

//        arr1.clear();
        System.out.println(arr1.contains("b"));
        System.out.println("arr1 = " + arr1);
    }
}